﻿using B.S.GridManager.Api.Read.Application.Command.PhysicalGrid;
using B.S.GridManager.Api.Read.Dtos;
using B.S.GridManager.ErrorCode;
using MediatR;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;

namespace B.S.GridManager.Api.Read.Controllers
{
    /// <summary>
    /// 物理网格控制器
    /// </summary>

    [Route("api/[controller]/[action]")]
    [ApiController]
    public class PhysicalController : ControllerBase
    {
        private readonly IMediator mediator;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="mediator"></param>
        public PhysicalController(IMediator mediator)
        {
            this.mediator = mediator;
        }
        /// <summary>
        /// 获取物理网格分页列表的查询接口
        /// </summary>
        /// <param name="request">查询参数</param>
        /// <returns>相应包装类包装的物理网格分页列表</returns>
        [HttpGet]
        public Task<ApiPaging<PhysicalGridDto>> GetPhysicalGrid([FromQuery] GetPhysicalGridCommand request)
        {
            return mediator.Send(request);
        }
    }
}
